package com.hbsi.utils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * @author 程奕红
 * @version 1.0
 */
public class DBClose {



    public  static void release(ResultSet res, Statement statement, com.mysql.jdbc.Connection connection) throws SQLException {
        if(res!=null){
            res.close();
        }
        if(statement!=null){
            statement.close();
        }
        if(connection!=null){
            connection.close();
        }


    }


    public static  void release(Statement statement,Connection connection) throws SQLException {

        if(statement!=null){
            try {
                connection.close();
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }
        if(connection!=null){
            connection.close();
        }
    }








}
